# -*- coding: utf-8 -*-

from w.blocks.containers.string_field import StringField

from w.html.useful import CheckInput
from w.html.doctypes.preferable import Span

class CheckBox(StringField):
    def __init__(self, content=None, checked=False, *argv, **kwargv):
        StringField.__init__(self, *argv, **kwargv)

        self.checked = checked
        self.tag = CheckInput(hchecked=self.checked, hname=self.name)
        self.content = Span(content)
        self.html = self.tag.html

    def make(self, content=[]):
        self.tag = Span([self.tag, self.content])
        return StringField.make(self)

